<template>
  <div>
    <el-table :height="tableHeigth" v-loading="loading" :data="tableData" style="width: 100%"
      :row-class-name="tableRowClassName">
      <el-table-column prop="name" label="分析名称" />
      <el-table-column prop="deptCode" label="创建者" />
      <el-table-column prop="deptPhone" label="创建时间" />
      <el-table-column label="操作" width="400" align="center">
        <template #default="scope">
          <!-- 如何发布时间给父组件  -->
          <!-- <el-button type="primary" size="default" :icon="Edit" @click="editBtn(scope.row)">
            编辑
          </el-button> -->
          <el-button size="default" type="success" :icon="Edit" @click="editEcheckList((scope.row))">检查单管理</el-button>
          <el-button size="default" type="danger" :icon="Close" @click="deleteBtn((scope.row.id))">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

  </div>
</template>

<script setup lang='ts'>
import { reactive, toRefs, onBeforeMount, onMounted } from 'vue'
import { Search, Plus, Edit, Close } from '@element-plus/icons'

const props = defineProps({
  tableHeigth: {
    type: Number,
    default: 0
  },
  tableData: {
    type: Array,
    default: () => []
  },
  loading: {
    type: Boolean,
    default: false
  }
})
const tableRowClassName = ({ row, rowIndex }) => {
  if (rowIndex % 2 === 1) {
    return "warning-row";
  } else {
    return "success-row";
  }
}
const emit = defineEmits(['deleteBtn', 'editBtn', 'editEcheckList'])
const deleteBtn = (row) => {
  emit('deleteBtn', row)
}

const editBtn = (row) => {
  emit('editBtn', row)
}
const editEcheckList = (row) => {
  emit('editEcheckList', row)
}
</script>
<style scoped lang='scss'></style>